<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>
<form name="form1" id="form1" action="${systemctx}/sample/saveSample.web" method="post">
	<input type="hidden" name="userids" id="userids">
	<div class="pageMain">
		<div class="pageTitle">
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.bascsetting.title")%>
			<span></span>
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.userduty.title.check") %>
			<span></span>
			<%=MessageResourcesUtils.getMessage(request, "systemmanage.userduty.manage.check.title")%>
		</div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i></i>
						<label>
							<%=MessageResourcesUtils.getMessage(request, "systemtmanage.user.column.username")%>
						</label>
						<span><input type="text" id="username" name="username"/></span> 
					</li>
				</ul>
			</div>	
		</div>
		<div class="button-group">
			<input type="button" class="btn btn-default" id="butQuery" name="butQuery" value="<%=MessageResourcesUtils.getMessage(request, "common.button.query") %>" />
			<input type="button" class="btn btn-default" onclick="check()" value="<%=MessageResourcesUtils.getMessage(request, "common.button.check") %>" />			
		</div>
		<table width="100%">
			<tbody>
				<tr>
					<td>
						<table id="datagrid"></table>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</form>
<script type="text/javascript">
function check(){
	var ids = '';
	var rows = $('#datagrid').datagrid('getSelections');
	if(rows.length == 0){
		alert('<%=MessageResourcesUtils.getMessage(request, "systemmanage.userduty.choose.alert.title")%>');
		return;
	}else{
		ids = '';
		for(var i=0; i<rows.length; i++){
			ids=ids+rows[i].id+",";
		}
	}
	
	if (ids != '' && ids != undefined) {
		var userids = ids;
		if(confirm('<%=MessageResourcesUtils.getMessage(request, "systemmanage.userduty.message.confirm.checkinfo")%>')){
			// 显示进度条
			showSending();
			$.ajax({
				type : 'GET',
				url : '${systemctx}/systemmanage/userDuty/checkMore.json?userids='+userids,
				dataType : 'json',
				success : function(data) {
					//关闭执行...
					closeSending();
					if(data.messagetype == 1){//复核成功
						//显示AJAX请求后的提示信息
						$.fn.ajaxmessage(data);
						$('#datagrid').datagrid('reload',$('#form1').serializeObject());
						$('#datagrid').datagrid('clearSelections');
					}else{//复核失败
						//alert(data.message);
						$.fn.ajaxmessage(data);//打印信息
					}
				}
			});
		}
	}
}

	$(document).ready(function(){
		$('#datagrid').issdatagrid({
			formid : 'form1',
			title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.userduty.title.check")%>',
			width : 'auto',
			nowrap : true,
			autoRowHeight : false,
			singleSelect : false,
			striped : true,
			url : '${systemctx}/systemmanage/userDuty/queryCheckListInfoDataGrid.json',
			sortName: 'modifytime',
			sortOrder: 'desc',
			remoteSort : true,
			idField : 'id',
			pagination : true,
			rownumbers : true,
			showFooter : true,
			queryParams:$('#form1').serializeObject(),
			columns : [[ 
			  	{field:'ck', checkbox:true}, 
	            {title : '<%=MessageResourcesUtils.getMessage(request,"systemtmanage.user.column.userno")%>',field : 'userno',width : 125,sortable : true,align : 'left',formatter:function(value,row,index){
	            	 return "<a href=\"javascript:void(0)\" onclick=\"view('"+row.id+"')\">"+value+"</a>"
	            }},
	            {title : '<%=MessageResourcesUtils.getMessage(request,"systemtmanage.user.column.loginname")%>',field : 'loginname',sortable : true,align : 'left',width:140},
				{title : '<%=MessageResourcesUtils.getMessage(request,"systemtmanage.user.column.username")%>',field : 'username',sortable : true,align : 'left',width:140},
				{title : '<%=MessageResourcesUtils.getMessage(request,"systemtmanage.user.column.validstart")%>',field : 'validstart',sortable : true,align : 'center',width:100},
		        {title : '<%=MessageResourcesUtils.getMessage(request,"systemtmanage.user.column.validend")%>',field : 'validend',sortable : true,align : 'center',width:100},
		        {title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.userduty.user.status")%>',field : 'checkstatus',sortable : true,align : 'center',width:100},
		        {title : '<%=MessageResourcesUtils.getMessage(request,"systemmanage.userduty.column.postCheckStatus")%>',field : 'poststatus',sortable : true,width : 120,align : 'center'},
		        {field : 'id',hidden:true}
	        ]],
			onLoadSuccess : function(data) {

			}
		});
		$('#butQuery').click(function() {
			$('#datagrid').datagrid('load',$('#form1').serializeObject());
		});
	});
	
	function view(id){
		$(this).isswindow({
			noheader : true,
			url : '${systemctx}/systemmanage/userDuty/user/toCheckDutyList.web?userid='+id
		});
	}
	
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>